# split panes using | and -
bind - split-window -v
bind | split-window -h
# unbind '"'
# unbind %

# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# bind-key h if-shell "$is_vim" "send-keys C-b h"  "select-pane -L"
# bind-key j if-shell "$is_vim" "send-keys C-b j"  "select-pane -D"
# bind-key k if-shell "$is_vim" "send-keys C-b k"  "select-pane -U"
# bind-key l if-shell "$is_vim" "send-keys C-b l"  "select-pane -R"

bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R

# see http://superuser.com/questions/252214/slight-delay-when-switching-modes-in-vim-using-tmux-or-screen
set -sg escape-time 0


# C-b conflits the key for move back in bash
# C-, or C-; cannot be mapped
# C-a conflits the key for move to begging in bash
# use C-\
unbind C-b
set-option -g prefix 'C-\'
bind-key 'C-\' send-prefix


set -g status-left ""
#  the timestampe on the right is distracting, set it to empty.
set -g status-right ""
set -g status-style "bg=default"
# #I window index, #W window name, #F window flag
set -g window-status-format " #I:#W #F "
set -g window-status-current-format " #I:#W #F "
# for vim default colorscheme
# set -g window-status-current-style  "bg=#DAFA2C,fg=#2B2B78,bold"
# 949494 for gruvbox colorscheme
set -g window-status-current-style  "bg=#949494,fg=#FFD7AF,bold"


# inspired by https://sanctum.geek.nz/arabesque/vi-mode-in-tmux/
# use vi mode
# For example, this will affect the `<prefix>[` key, which enters copy mode
# with vi style of moving arround. `<prefix>]` will paste the selection
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

set -g focus-events on

